package com.stefanini.pe.bbva.mbl.in.dao;

import java.math.BigDecimal;
import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.stefanini.pe.bbva.mbl.carga.in.to.EliminarDetalle;
import com.stefanini.pe.bbva.mbl.in.dao.iface.EliminarDetalleDAO;

import org.apache.log4j.Logger;

public class EliminarDetalleDAOImpl extends SqlMapClientDaoSupport implements EliminarDetalleDAO {

	private static final Logger logger = Logger.getLogger(EliminarDetalleDAOImpl.class);
	
    public EliminarDetalleDAOImpl() {
        super();
    }

    public void deleteByPrimaryKey(BigDecimal idEliminarDetalle) {
    	EliminarDetalle key = new EliminarDetalle();
    	
    	logger.info("Inicio");
    	
        key.setIdEliminarDetalle(idEliminarDetalle);
        getSqlMapClientTemplate().delete("ELIMINARDETALLE.ibatorgenerated_deleteByPrimaryKey", key);
        
        logger.info("Fin");
    }

    public void insert(EliminarDetalle record) {
    	logger.info("Inicio");
    	
        getSqlMapClientTemplate().insert("ELIMINARDETALLE.ibatorgenerated_insert", record);
        
        logger.info("Fin");
    }

    public void insertSelective(EliminarDetalle record) {
    	logger.info("Inicio");
    	
        getSqlMapClientTemplate().insert("ELIMINARDETALLE.ibatorgenerated_insertSelective", record);
        
        logger.info("Fin");
    }

    public EliminarDetalle selectByPrimaryKey(BigDecimal id_control_eliminar) {
        EliminarDetalle key = new EliminarDetalle();
        EliminarDetalle eliminarDetalle = null; 
        
        logger.info("Inicio");
        
        key.setIdEliminarDetalle(id_control_eliminar);
        eliminarDetalle= (EliminarDetalle) getSqlMapClientTemplate().queryForObject("ELIMINARDETALLE.ibatorgenerated_selectByPrimaryKey", key);
        
        logger.info("Fin");
        
        return eliminarDetalle;
    }
    
    public List selectByControl(BigDecimal id_control_eliminar) {
        EliminarDetalle key = new EliminarDetalle();
        List listEliminarDetalle = null; 
        
        logger.info("Inicio");
        
        key.setIdControlEliminar(id_control_eliminar);
        listEliminarDetalle= getSqlMapClientTemplate().queryForList("ELIMINARDETALLE.ibatorgenerated_selectByControl", key);
        
        logger.info("Fin");
        
        return listEliminarDetalle;
    }
    
    public List selectByCriteria(EliminarDetalle eliminarDetalle) {
        List lista= null;
        
        logger.info("Inicio");
        
        lista= (List)getSqlMapClientTemplate().queryForObject("ELIMINARDETALLE.ibatorgenerated_selectByCriteria", eliminarDetalle);
        
        logger.info("Fin");
        
        return lista;
    }
    
    public void updateByPrimaryKeySelective(EliminarDetalle record) {
    	logger.info("Inicio");
    	
        getSqlMapClientTemplate().update("IIPG_TIIPG_ELIMINARDETALLE.ibatorgenerated_updateByPrimaryKeySelective", record);
        
        logger.info("Fin");
    }

    public void updateByPrimaryKey(EliminarDetalle record) {
    	logger.info("Inicio");
    	
        getSqlMapClientTemplate().update("ELIMINARDETALLE.ibatorgenerated_updateByPrimaryKey", record);
        
        logger.info("Fin");
    }
    
    public List selectAll(){
        List records = null;
        
        logger.info("Inicio");
        
        records = this.getSqlMapClientTemplate().queryForList("ELIMINARDETALLE.ibatorgenerated_selectAll", null);
        
        logger.info("Fin");
        
        return records;
    }
}
